SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[usp_EmployerSearchApplyField]
    (
      @JOL_Field_ApplyCompany VARCHAR(50),
      @JOL_Field_Action VARCHAR(100),
      @JOL_Field_ApplyPosition VARCHAR(50)
    )
AS 
    SELECT  a.JOL_Field_No,
            b.JOL_Employer_Name,
            a.JOL_Field_Purpose,
            a.JOL_Field_Action,
            a.JOL_Field_ApplyTime,
            a.JOL_Field_ApplyPosition,
            a.JOL_Field_VerifyStatus,
            a.JOL_ApplyField_EndTime,
            a.JOL_Field_Remark
    FROM    dbo.JOL_ApplyField AS a
            INNER JOIN dbo.JOL_Employer AS b ON a.JOL_Field_ApplyCompany = b.JOL_Employer_Account
    WHERE   ( a.JOL_Field_Action LIKE '%' + @JOL_Field_Action + '%' )
            AND ( a.JOL_Field_ApplyPosition LIKE '%'
                  + @JOL_Field_ApplyPosition + '%' )
            AND ( b.JOL_Employer_Name = @JOL_Field_ApplyCompany )
    ORDER BY a.JOL_Field_AddTime DESC,
            a.JOL_Field_ApplyCompany ASC


GO
